import time
from distutils.command.check import check
from pickletools import long1
from time import sleep

from Tools.scripts.cleanfuture import dryrun
from selenium.webdriver.common.by import By

from common.com import forum, Driver
#注册页面的测试
class fpega:
    # url = ""
    driver = ""
    def __init__(self):
        # self.url = "http://127.0.0.1:9580/index.html"
        self.driver = forum.driver
        # self.driver.get(self.url)
    def fcheckelement(self):
        time.sleep(1)
        #进行元素查找

        self.driver.find_element(By.CSS_SELECTOR,"#artical-items-body > div:nth-child(1) > div > div.col > div.text-truncate > a > strong")
        self.driver.find_element(By.CSS_SELECTOR,"#index_nav_nickname")
        self.driver.find_element(By.CSS_SELECTOR, "#topBoardList > li:nth-child(2) > a")
        self.driver.find_element(By.CSS_SELECTOR, "#bit-forum-content > div.page-header.d-print-none > div > div > div.col-auto.ms-auto.d-print-none > div > a.btn.btn-primary.d-none.d-sm-inline-block.article_post")
        self.driver.find_element(By.CSS_SELECTOR, "body > div.page > header.navbar.navbar-expand-md.navbar-light.d-print-none > div > div > div.nav-item.d-none.d-md-flex.me-3 > div > form > div > input")
        #进行截图
        forum.getscreenshot()

    # #测试搜索功能
    # def search(self):
    #     #测试用例一：输入正确的帖子标题进行搜索
    #
    #     #寻找输入框并清理
    #     self.driver.find_element(By.CSS_SELECTOR,"body > div.page > header.navbar.navbar-expand-md.navbar-light.d-print-none > div > div > div.nav-item.d-none.d-md-flex.me-3 > div > form > div > input").clear()
    #     #对搜索框进行输入
    #     self.driver.find_element(By.CSS_SELECTOR,"body > div.page > header.navbar.navbar-expand-md.navbar-light.d-print-none > div > div > div.nav-item.d-none.d-md-flex.me-3 > div > form > div > input").send_keys("这是一个进行测试的帖子")
    #
    #     ##############################
    #     #测试用例二：输入关键字标题进行搜索
    #     #寻找输入框并清理
    #     self.driver.find_element(By.CSS_SELECTOR,"body > div.page > header.navbar.navbar-expand-md.navbar-light.d-print-none > div > div > div.nav-item.d-none.d-md-flex.me-3 > div > form > div > input").clear()
    #     #对搜索框进行输入
    #     self.driver.find_element(By.CSS_SELECTOR,"body > div.page > header.navbar.navbar-expand-md.navbar-light.d-print-none > div > div > div.nav-item.d-none.d-md-flex.me-3 > div > form > div > input").send_keys("这是一个进")
    #
    #     ##############################




# fpega = fpega()
# fpega.fcheckelement()